<?php
/*code here*/
/* Redirect user if they already logged */
if(Auth::hasAuth('current_user'))
{
    $this->view->current_user = Auth::getAuth('current_user');

    header('location: /home');
}
/* For user login if correct redirect to home */
if($_SERVER['REQUEST_METHOD'] == "POST")
{
    $username = $_POST['username'];
    $password = $_POST['password'];
    $session = new Auth();
    $login = $session->login($username,$password,'username','password','tblusers');
    if($login)
    {
       header('Location: /home'); 
    }
}   
/*code here(end)*/
$this->setLayout();